package com.huirui.server.pojo.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 临期商品VO（数据传输对象）
 * 用于接收/返回临期商品相关信息
 */
@Data
@Schema(description = "临期商品VO，包含商品基础信息、价格、库存、日期等核心字段")
public class ShortDatedProductVo {

    @Schema(description = "商品ID（唯一标识）", example = "10001", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Long productId;

    @Schema(description = "商品名称", example = "常温纯牛奶", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private String productName;

    @Schema(description = "商品图片")
    private String imageUrl;

    @Schema(description = "商品最低原价", example = "69.9", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private BigDecimal minPrice;

    @Schema(description = "商品最高原价", example = "89.9", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private BigDecimal maxPrice;

    @Schema(description = "商品最低促销价", example = "49.9", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private BigDecimal minPromotionPrice;

    @Schema(description = "商品最高促销价", example = "59.9", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private BigDecimal maxPromotionPrice;

    @Schema(description = "商品总库存数量", example = "500", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Long stock;

    @Schema(description = "商品可用库存数量（可销售库存）", example = "480", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Long availableStock;

    @Schema(
            description = "商品创建时间（格式：yyyy-MM-dd HH:mm:ss）",
            example = "2025-11-01 10:30:00",
            type = "string",
            format = "date-time",
            requiredMode = Schema.RequiredMode.NOT_REQUIRED
    )
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;

    @Schema(
            description = "商品生产日期（格式：yyyy-MM-dd）",
            example = "2025-10-01",
            type = "string",
            format = "date",
            requiredMode = Schema.RequiredMode.NOT_REQUIRED
    )
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate manufacturingDate;

    @Schema(
            description = "商品过期日期（格式：yyyy-MM-dd）",
            example = "2026-04-01",
            type = "string",
            format = "date",
            requiredMode = Schema.RequiredMode.NOT_REQUIRED
    )
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate expiryDate;

    @Schema(description = "商品原价")
    private BigDecimal price;

    @Schema(description = "商品优惠价")
    private BigDecimal promotionPrice;

    @Schema(description = "折扣")
    private BigDecimal discountRate;
}
